

layout(location = 0) in vec3 vertex;

layout(std140) uniform cameraData {
  mat4 viewMatrix;
  mat4 projMatrix;
  vec3 viewPos;
};

uniform mat4 modelMatrix;

uniform mat4 oldModelMatrix;
uniform mat4 oldViewMatrix;
uniform mat4 oldProjMatrix;

out vec4 oldPos;
out vec4 currentPos;

void main() {

  currentPos = projMatrix * viewMatrix * modelMatrix * vec4(vertex, 1.0);

  oldPos = oldProjMatrix * oldViewMatrix * oldModelMatrix * vec4(vertex, 1.0);

  gl_Position = currentPos;
}